<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Test01</title>
    <script src="https://unpkg.com/vue/dist/vue.js" type="text/javascript"></script>
</head>
<body>

<div id="app">
    <p>{{ message.split('').reverse().join('') }}</p>
    <p>{{ reverseMessage }}</p>
    <!--    <p>{{ reverseMessage }}</p>-->
    <!--    <p>{{ reverseMessage }}</p>-->
    <!--    <p>{{ reverseMessage() }}</p>-->
    <!--    <p>{{ reverseMessage() }}</p>-->
</div>

<script>
    let vm = new Vue({
        el: '#app',
        data: {
            message: 'Hello Vue!',
        },
        // methods: {
        //     reverseMessage: function () {
        //         console.log("reverseMessage");
        //         return this.message.split('').reverse().join('')
        //     }
        // },
        computed: {
            reverseMessage: {
                get: function () {
                    console.log("reverseMessage");
                    return this.message.split('').reverse().join('')
                },
                set: function (val) {
                    this.message = val;
                }
            }
        }
    });

    vm.reverseMessage = '12345678';

</script>

</body>
</html>